/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author waiz
 */
public class Data {
    
    double[]data;
    int count;
    
    public Data() {
        
    }
    
    public Data(double[]dta,int a){
        
        data=dta;
        count=a;
        
    }
    
    public double[] getData(){
        return data;
    }
    
    public double[] getData(boolean sort){
        sortData();
        return data;
    }
    
    public void sortData(){
      
        int j=1;
            
        while(j<this.count){
          int i;
          int temp=j;
             for(i=j-1;i>=0;i--){
                 
                 if(data[temp]<data[i]){
                     swap(temp,i);
                     temp=i;
                 }
                 else break;
             }
          j++;
        }
        }
    
    
    public void swap(int index1,int index2){
        double temp;
        temp=data[index2];
        data[index2]=data[index1];
        data[index1]=temp;
    }
    
    public double getData(int index){
         return data[index];
       
    }
    
    
    public int getSize(){
        return count;
    }
    
    public void print(){
        
        int i=0;
        System.out.print("Data anda : ");
        while(i<count){
            System.out.print(data[i]+" ");
            i++;
        }
        System.out.println();
    }
}
